package com.rw.tool.util.expression.expression.calculator.element;

import com.rw.tool.util.expression.element.Calculation;

import java.math.BigDecimal;

/**
 * 减法计算器
 */
public class MinusCalculatorElement extends CalculatorElement {
    @Override
    public boolean trigger(Calculation calculation) {
        return calculation == Calculation.MINUS;
    }

    @Override
    public BigDecimal handler(BigDecimal leftNumber, Calculation calculation, BigDecimal rightNumber) {
        return leftNumber.subtract(rightNumber);
    }
}
